package com.example.safeassistan.message.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;

import java.util.List;

public class MessageAdapter extends BaseQuickAdapter<Integer, BaseViewHolder> {

    public MessageAdapter(List<Integer> data) {

        super(R.layout.item_message, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Integer item) {
//        helper.setText(R.id.tvMsgTitle,"【"+item.getTitle()+"】");
//        String title =String.format(item.getContent()+"<font color=#FF7D00>%s</font>" ," 点击查看详情");
//        helper.setText(R.id.tvMSgContent, Html.fromHtml(title));
//        helper.setText(R.id.tvCreateTime,item.getCreateTime());

        TextView tvType=helper.getView(R.id.tvType);
        switch (item%2){
            case 0:
                helper.setText(R.id.tvType,"消息");
                tvType.setTextColor(mContext.getResources().getColor(R.color.blue_3B5BEA));
                helper.getView(R.id.tvType).setBackgroundResource(R.drawable.lightblue_circle_48);
                break;
            case 1:
                helper.setText(R.id.tvType,"通知");
                tvType.setTextColor(mContext.getResources().getColor(R.color.yellow));
                helper.getView(R.id.tvType).setBackgroundResource(R.drawable.light_yellow_circle_48);
                break;
        }
    }
}
